#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int i, n, s1 = -1, s2 = 101, m;
    scanf("%d", &m);
    for (i = 0; i < m; i++)
    {
        scanf("%d", &n);
        if (n >= s1)
            s1 = n;
        if (n <= s2)
            s2 = n;
    }
    printf("%d\n", s1 - s2);
    return 0;
}